package cn.tedu._01mvcboot01.controller;

import cn.tedu._01mvcboot01.pojo.dto.UserRegDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    /**
     * RequestMapping注解:请求注解，根据请求的路径PATH映射到具体的控制方法;
     * ResponseBody注解:响应注解，允许控制器方法以返回值的形式返回给客户端数据;
     * @return
     */
    @RequestMapping("/v1/user/login")
    @ResponseBody
    public String login(String username,String password){
        return "欢迎" + username + "登录，您的密码是:" + password;
    }
    @RequestMapping("/v1/user/reg")
    @ResponseBody
    public String reg(UserRegDTO userRegDTO){
        String username = userRegDTO.getUsername();
        return "恭喜:" + username + "注册成功";
    }
}
